Vec2 Class
Description:
A class for creating Vec2 objects.
__call
Type: Metamethod.
Description:
Creates a new Vec2 object from an existing Vec2 object.
Signature:
metamethod __call: function(self: Vec2Class, other: Vec2): Vec2
Usage:
local newVec = Vec2(existingVec)
Parameters:
Parameter | Type | Description |
---|---|---|
other | Vec2 | The existing Vec2 object to create the new object from. |
Returns:
Return Type | Description |
---|---|
Vec2 | The new Vec2 object. |
__call
Type: Metamethod.
Description:
Creates a new Vec2 object with the given x and y components.
Signature:
metamethod __call: function(
self: Vec2Class,
x: number,
y: number
): Vec2
Usage:
local newVec = Vec2(10, 20)
Parameters:
Parameter | Type | Description |
---|---|---|
x | number | The x-component of the new vector. |
y | number | The y-component of the new vector. |
Returns:
Return Type | Description |
---|---|
Vec2 | The new Vec2 object. |
__call
Type: Metamethod.
Description:
Creates a new Vec2 object from a Size object.
Signature:
metamethod __call: function(self: Vec2Class, size: Size): Vec2
Usage:
local newVec = Vec2Class(Size(10, 20))
Parameters:
Parameter | Type | Description |
---|---|---|
size | Size | The Size object to create the new vector from. |
Returns:
Return Type | Description |
---|---|
Vec2 | The new Vec2 object. |
zero
Type: Readonly Field.
Description:
Gets zero-vector object.
Signature:
const zero: Vec2